package com.ggh.jinjilive.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.cy.dialog.BaseDialog;
import com.ggh.jinjilive.R;
import com.ggh.jinjilive.listener.AddItemOnClickListener;

public class LivePromptDialog extends BaseDialog {
    //提示标题
    private TextView tv_title;
    //取消
    private Button button_shut;
    //确认
    private Button button_confirm;

    public LivePromptDialog(Context context) {
        super(context);
    }

    public LivePromptDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        contentView(R.layout.dialog_live_occlude);
        canceledOnTouchOutside(false);
        gravity(Gravity.CENTER);
        animType(BaseDialog.AnimInType.CENTER);
        //提示标题
        tv_title = findViewById(R.id.tv_title);
        //取消
        button_shut = findViewById(R.id.button_shut);
        //确认
        button_confirm = findViewById(R.id.button_confirm);
        //取消
        findViewById(R.id.button_shut).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(null != addItemOnClickListener){
                    addItemOnClickListener.onSkipClicked(0,"拒绝");
                }
            }
        });
        //确认
        findViewById(R.id.button_confirm).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(null != addItemOnClickListener){
                    addItemOnClickListener.onSkipClicked(1,"确认");
                }
            }
        });
    }

    /**
     * 提示标题
     * @param title
     */
    public void setTitle(String title){
        if(null != tv_title){
            //提示标题
            tv_title = findViewById(R.id.tv_title);
        }
        tv_title.setText(title);
    }

    /**
     * 取消
     */
    public void setShut(String Shut){
        if(null != button_shut){
            //取消
            button_shut = findViewById(R.id.button_shut);
        }
        button_shut.setText(Shut);
    }

    /**
     * 确认
     * @param Confirm
     */
    public void setConfirm(String Confirm){
        if(null != button_confirm){
            //取消
            button_confirm = findViewById(R.id.button_confirm);
        }
        button_confirm.setText(Confirm);
    }


    private AddItemOnClickListener addItemOnClickListener;
    public void setAddItemOnClickListener(AddItemOnClickListener addItemOnClickListener){
        this.addItemOnClickListener = addItemOnClickListener;
    }
}
